/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package fsktms.request;

import static fsktms.request.RequestParameters.KEY_FAILURE_CODE;
import static fsktms.request.RequestParameters.KEY_RESULT;
import java.io.Serializable;

/**
 *
 * @author salm
 */
public class RequestRespond extends RequestParameters
{
    public boolean isSuccess()
    {
        return (this.get(RequestRespond.KEY_FAILURE_CODE) == null) && (this.getResult() != null);
    }
    
    public boolean isFailed()
    {
        return !this.isSuccess();
    }
    
    public RequestRespond setResult(Serializable value)
    {
        this.set(KEY_RESULT, value);
        
        return this;
    }
    
    public Serializable getResult()
    {
        return this.get(KEY_RESULT);
    }
    
    public int getErrorCode()
    {
        return this.getInteger(KEY_FAILURE_CODE);
    }
    
    public int getErrorDescription()
    {
        return this.getInteger(KEY_FAILURE_DESCRIPTION);
    }
}
